#ifndef ODB_RELATIONSHIP_HXX
#define ODB_RELATIONSHIP_HXX

#include <boost/date_time/posix_time/posix_time.hpp>
#include <odb/core.hxx>
#include <odb/nullable.hxx>
#include <string>

namespace chat{
#pragma db object table("relationship")
class Relationship {
   public:
    Relationship() = default;
    Relationship(const std::string& user_id, const std::string& peer_id)
        : user_id_(user_id), peer_id_(peer_id) {}

    void user_id(const std::string& user_id) { user_id_ = user_id; }
    const std::string& user_id() const { return user_id_; }

    void peer_id(const std::string& peer_id) { peer_id_ = peer_id; }
    const std::string& peer_id() const { return peer_id_; }

   private:
    friend class odb::access;
#pragma db id auto
    unsigned long id_;
#pragma db type("VARCHAR(64)") index
    std::string user_id_;       // 用户id
#pragma db type("VARCHAR(64)")
    std::string peer_id_;       // 好友id
};
using RelationshipPtr = std::shared_ptr<Relationship>;
}  // namespace

#endif  // ODB_RELATIONSHIP_HXX
